// Author: Domien Nowicki
#ifndef TOOLBOXWIDGET_H
#define TOOLBOXWIDGET_H

#include <QWidget>
#include <QVBoxLayout>
#include <QHBoxLayout>
#include <QPushButton>
#include <QFrame>
#include <QGridLayout>
#include <QLabel>
#include <QGroupBox>
#include <QPixmap>

class ToolboxWidget: public QWidget
{
	Q_OBJECT

public:
	enum Tool
	{
		NONE,
		CAMERA,
		WALL,
		ERASE,
		TEXTURE
	};


	ToolboxWidget(QWidget *parent=0);
	virtual ~ToolboxWidget();

	enum Tool GetToolType() const;
	void SetCurrentTexture(const QPixmap& textureThumb);
	void SetEmptyTexture();

protected:
	QSize minimumSizeHint() const;

signals:
	void clickedTool(enum ToolboxWidget::Tool);
	void clickedTextureList(void);

private slots:
	void slotCameraToolClicked();
	void slotWallToolClicked();
	void slotEraserToolClicked();
	void slotTextureToolClicked();
	void slotTextureListClicked();

private:
	void SetupEmptyPixmap();
	void SetToolState(enum ToolboxWidget::Tool type);

	QPushButton* AddButton(const QString& iconFilename);
	QPushButton* CreateButton(const QString& iconFilename, bool checkable=true);

	QVBoxLayout *vboxLayout;
	QHBoxLayout *textureToolLayout;

	QPushButton *cameraTool, *wallTool, *eraserTool, *textureTool, *textureListButton;
	QGroupBox *textureImageBox;
	QGridLayout *textureImageLayout;
	QLabel *textureImageLabel;
	QSpacerItem *spacerItem;
	enum Tool toolType;

	QPixmap emptyTexture, currentTexture;

	static const unsigned int THUMB_WIDTH = 64;
	static const unsigned int THUMB_HEIGHT = 64;
	static const unsigned int SQUARESIZE = 8;
};

#endif //TOOLBOXWIDGET_H

